<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class HomeUserpasswordLogin extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
     public function authorize()
     {
         return true;
     }

     public function rules()
     {
         return [
             'phone' => ['required', 'regex:/^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/u'],
             'password' => 'required|min:6',
         ];
     }

     public function messages()
     {
         return [
             'phone.required'    => '手机号码不能为空',
             'phone.regex'       => '手机号格式不正确',
             'password.required' => '密码不能为空',
             'password.min'      => '密码不能少于6位',
         ];
     }
}
